Skip to content

fix(ci): parse single-equals interrogate section headers#1704

Open
Thabhelo wants to merge 2 commits into
NVIDIA:mainfrom
Thabhelo:fix/interrogate-header-parser
Open

fix(ci): parse single-equals interrogate section headers#1704
Thabhelo wants to merge 2 commits into
NVIDIA:mainfrom
Thabhelo:fix/interrogate-header-parser

Conversation

@Thabhelo
Copy link
Copy Markdown

@Thabhelo Thabhelo commented Jun 6, 2026

Summary

  • Broaden the interrogate output parser in check_docstring_coverage.py to accept section headers with any number of equals signs (including the single-= format used by interrogate 1.7).
  • Add unit tests for single- and multi-equals header parsing.

Related context: #1703 added docstrings on a few crash example symbols because the hook falsely reported baseline-grandfathered items as new when editing example files. This PR fixes that root cause.

Test plan

  • pytest test/ci_tests/test_check_docstring_coverage.py
  • python test/ci_tests/check_docstring_coverage.py examples/structural_mechanics/crash/datapipe.py examples/structural_mechanics/crash/train.py (passes with baseline-only gaps, no false positives)

Interrogate 1.7 prints "= Coverage for ... =" headers, but the docstring
coverage checker only matched 4+ equals signs. That left current_dir empty,
produced wrong file paths, and falsely flagged baseline grandfathered items
as new undocumented symbols when example files were edited.

Signed-off-by: Thabhelo <50872400+Thabhelo@users.noreply.github.com>
@copy-pr-bot
Copy link
Copy Markdown

copy-pr-bot Bot commented Jun 6, 2026

This pull request requires additional validation before any workflows can run on NVIDIA's runners.

Pull request vetters can view their responsibilities here.

Contributors can view more details about this message here.

@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps Bot commented Jun 6, 2026

Greptile Summary

This PR fixes a false-positive in the docstring-coverage pre-commit hook by broadening the interrogate output parser to accept section headers that use any number of equals signs, including the single-= format introduced in interrogate 1.7. Two unit tests are added to cover both the single-equals and multi-equals header variants.

  • check_docstring_coverage.py: Regex changed from ={4,} to =+, letting the parser handle interrogate 1.7's = Coverage for … = header style without touching any other logic.
  • test_check_docstring_coverage.py: New test module with two parameterized scenarios (single-equals, multi-equals) that exercise _parse_interrogate_output directly.

Important Files Changed

Filename Overview
test/ci_tests/check_docstring_coverage.py Regex broadened from ={4,} to =+ so single-equals interrogate 1.7 section headers are parsed correctly alongside the existing multi-equals format.
test/ci_tests/test_check_docstring_coverage.py New test file covering both single-equals and multi-equals header variants; import works via pytest's rootdir sys.path injection but would benefit from a conftest.py for resilience.

Reviews (1): Last reviewed commit: "fix(ci): parse single-equals interrogate..." | Re-trigger Greptile

Comment thread test/ci_tests/test_check_docstring_coverage.py
Add test/ci_tests/conftest.py so the bare-module import in
test_check_docstring_coverage.py stays reliable across pytest
import modes.

Signed-off-by: Thabhelo <50872400+Thabhelo@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant